<?php
/*
Template Name: Contact Us template
 */
?>

<?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="col3">
	<div class="clearfix" id="col3_content">          
		<div id="main_content">
			<div id="main_content_foot">
			     
				<div class="contentpaneopen_cnt">
					<div class="contentheading_cnt">
						<h1>Vietnam Embassy Visas | Contact Information of Visa - Vietnam</h1>
					</div>
	            </div>
	        <?php
				include 'checkinput.php';
	        	if($_POST['btnSubmitContact'])
	        	{
		        	$name = (string)$_REQUEST['primaryname'];
					$email=(string)$_REQUEST['email'];
					$retypeemail = (string)$_REQUEST['retypeemail'];
					$subject = (string)$_REQUEST['subject'];
					$message = (string)$_REQUEST['message'];
					$flag = 1;
					$flagemail = vailemail($email);
					$flagname = vailname($name);
					$flagretypeemail = 1;
					$flagsubject = ($subject == "" ? -1 : 1);
					$flagmessage = ($message == "" ? -1 : 1);
					
					if(!($email==$retypeemail)){
						$flagretypeemail=-1;
					}
					$flag=($flagname>-1)&&($flagemail>-1)&&($flagretypeemail>-1)&&($flagmessage>-1)&&($flagsubject>-1);
		        }
		        else{
		        	$name = "Type your name";
					$email= "Type your email";
					$retypeemail = "Retype your email";
					$subject = "Type Subject";
					$message = "Type message";
		        }
				if($flag>0){
					//what to do
					//mail("letram105.07DB354@gmail.com",$subject,$message,0,0);
					echo "Thank you for your interest on our services. We will get back to you soon. </br>";
				}
	        	else{
	        		if($_POST['btnSubmitContact']){
						if($flagname<=-1){
							echo "Name is empty.</br>";
						}
						if($flagemail<=-1){
							echo "Email is not a valid format.</br>";
						}
						if($flagretypeemail==-1){
							echo "Email and Retype Email must be the same.<br>";
						}
						if($flagsubject==-1){
							echo "Subject is empty.</br>";
						}
						if($flagmessage==-1){
							echo "Message is empty.</br>";
						}
						?>
						<div class="contentpaneopen_cnt">
			            	<div class="cnt-form">
			                	<div class="cnt-form_left">
			                    	<form method="post" action=""> 
			                        	<input type="hidden" value="send message" name="act" />
			                        	<label class="">Name</label>
			                        	<input type="text" class="" value="<?php echo $name;?>" name="primaryname" id="primaryname" />
			                   	     	<label class="">Email Address</label>	
			                        	<input type="text" class=""  value="<?php echo $email;?>" name="email" id="email" /> 
			                        	<label>Retype Email</label>
			                        	<input type="text" value="<?php echo $retypeemail;?>" id="retypeemail" name="retypeemail" />           
			                         	<label class="">Subject</label>
			                         	<input type="text" class="" value="<?php echo $subject;?>" id="subject" name="subject" />     
			                        	<label class="">Your message</label>     
			                        	<textarea id="message" value = "<?php echo $message;?>" name="message"></textarea>
			                         	<div class="submit_form2">
			                            	<input type="submit" onclick="submitForm(1);" value="Send Message" name="btnSubmit" class="button1">
			                            </div> 
			                     	</form>   
			               		</div>
			                    <div class="cnt-form_right">
									<p>We welcome any request, comment or feedback from you. Please fill in this form then send us your message. With this form, you could send us your request for Vietnam visa, comment on our service or feedback on our service. Or you can mail to <a href="mailto:info@visa-vietnam.org">info@visa-vietnam.org</a>.</p><br>
									<p>For any complaint on our Vietnam visa services, please email directly to Nguyen Cuong (Mr.) &ndash; Team Leader at <a href="mailto:ceo@visa-vietnam.org">ceo@visa-vietnam.org</a> <br>Thanks.</p><br>
									<p><strong>Nguyen Cuong (Mr.)</strong><br>Team Leader</p>				
			               		</div>
			               </div>
			            </div>
						<?php 
	        		}
					else 
					{
	   		?> 
	            <div class="contentpaneopen_cnt">
	            	<div class="cnt-form">
	                	<div class="cnt-form_left">
	                    	<form method="post" action=""> 
	                        	<input type="hidden" value="send message" name="act" />
	                        	<label class="">Name</label>
	                        	<input type="text" class="" value="<?php echo $name;?>" name="primaryname" id="primaryname" />
	                   	     	<label class="">Email Address</label>	
	                        	<input type="text" class=""  value="<?php echo $email;?>" name="email" id="email" /> 
	                        	<label>Retype Email</label>
	                        	<input type="text" value="<?php echo $retypeemail;?>" id="retypeemail" name="retypeemail" />           
	                         	<label class="">Subject</label>
	                         	<input type="text" class="" value="<?php echo $subject;?>" id="subject" name="subject" />     
	                        	<label class="">Your message</label>     
	                        	<textarea id="message" value = "<?php echo $message;?>" name="message"></textarea>
	                         	<div class="submit_form2">
	                            	<input type="submit" onclick="submitForm(1);" value="Send Message" name="btnSubmitContact" class="button1">
	                            </div> 
	                     	</form>   
	               		</div>
	                    <div class="cnt-form_right">
							<p>We welcome any request, comment or feedback from you. Please fill in this form then send us your message. With this form, you could send us your request for Vietnam visa, comment on our service or feedback on our service. Or you can mail to <a href="mailto:info@visa-vietnam.org">info@visa-vietnam.org</a>.</p><br>
							<p>For any complaint on our Vietnam visa services, please email directly to Nguyen Cuong (Mr.) &ndash; Team Leader at <a href="mailto:ceo@visa-vietnam.org">ceo@visa-vietnam.org</a> <br>Thanks.</p><br>
							<p><strong>Nguyen Cuong (Mr.)</strong><br>Team Leader</p>				
	               		</div>
	               </div>
	            </div>
				<?php }
					}?>
			</div><!-- #main_content_foot -->					
		</div><!-- #main_content -->

<?php get_footer(); ?>